<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            border: 1px solid;
            margin-top: 20px;
        }
    </style>
</head>

<body>
    <button onclick="showDiv();">显示</button>
    <div style="display: none;" class="box">
        <p>xxxxxx</p>
        <p>xxxxxx</p>
        <p>xxxxxx</p>
    </div>


    <script>
        function showDiv() {
            var $box = document.querySelector('.box');
            var $button = document.querySelector('button');
            var flag = $box.style.display;
            if (flag === 'none') {
                $box.style.display = 'block';
                $button.innerText = '隐藏';
            } else {
                $box.style.display = 'none';
                $button.innerText = '显示';
            }
        }
    </script>
</body>

</html>